home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 November: Tool Chest / Dev.CD Nov 00 TC Disk 1.toast / Sample Code / Devices and Hardware / Display Manager / DMFkey Source / RequestVideo.h < prev   
Encoding:
C/C++ Source or Header  |  2000-09-28  |  4.1 KB  |  91 lines  |  [TEXT/CWIE]

  1. /*
  2.     File:        RequestVideo.h
  3.     
  4.     Description:RequestVideo demonstrates the usage of the Display Manager
  5.                 introduced    with the PowerMacs and integrated into the system
  6.                 under System 7.5. With    the RequestVideo sample code library, 
  7.                 developers will be able to explore the Display Manager API by
  8.                 changing bit depth and screen resolution on    multisync displays
  9.                 on built-in, NuBus, and PCI based video. Display Manager 1.0
  10.                 is built into the Systems included with the first PowerMacs up
  11.                 through System 7.5.    Display Manager 2.0 is included with the 
  12.                 release of the new PCI based PowerMacs, and will be included
  13.                 in post 7.5 System Software releases. 
  14.                     
  15.                 It is a good idea to reset the screen(s) to the original setting 
  16.                 before exit since the call to RVSetVideoAsScreenPrefs() may not
  17.                 do the right thing under Display Manager 1.0 with certain video 
  18.                 drivers.
  19.     
  20.                 For information on the use of this sample code, please the 
  21.                 documentation in the Read Me file
  22.  
  23.  
  24.     Author:        EWA
  25.  
  26.     Copyright:     Copyright: © 1995-1999 by Apple Computer, Inc.
  27.                 all rights reserved.
  28.     
  29.     Disclaimer:    You may incorporate this sample code into your applications without
  30.                 restriction, though the sample code has been provided "AS IS" and the
  31.                 responsibility for its operation is 100% yours.  However, what you are
  32.                 not permitted to do is to redistribute the source as "DSC Sample Code"
  33.                 after having made changes. If you're going to re-distribute the source,
  34.                 we require that you make it clear in the source that the code was
  35.                 descended from Apple Sample Code, but that you've made changes.
  36.     
  37.     Change History (most recent first):
  38.                 6/24/99    Updated for Metrowerks Codewarror Pro 2.1(KG)
  39.                 5/31/95    Added RVGetCurrentVideoSetting and RVConfirmVideoRequest routines
  40.                         to make it easy to revert back to where you came from and to give
  41.                         the user a chance to confirm the new setting if the new mode was
  42.                         valid (ie: the card supports it) but not safe (the monitor may not).
  43.                         (EWA)
  44.                 5/24/95    Give the kAllValidModesBit requestFlags option for safe only or all
  45.                         valid resolution timings.(EWA)
  46.  
  47. */
  48.  
  49. #include <QuickDraw.h>
  50. #include <Video.h>
  51.  
  52. // requestFlags bit values in VideoRequestRec (example use: 1<<kAbsoluteRequestBit)
  53. enum {
  54.     kBitDepthPriorityBit        = 0,    // Bit depth setting has priority over resolution
  55.     kAbsoluteRequestBit            = 1,    // Available setting must match request
  56.     kShallowDepthBit            = 2,    // Match bit depth less than or equal to request
  57.     kMaximizeResBit                = 3,    // Match screen resolution greater than or equal to request
  58.     kAllValidModesBit            = 4        // Match display with valid timing modes (may include modes which are not marked as safe)
  59. };
  60.  
  61. // availFlags bit values in VideoRequestRec (example use: 1<<kModeValidNotSafeBit)
  62. enum {
  63.     kModeValidNotSafeBit        = 0        //  Available timing mode is valid but not safe (requires user confirmation of switch)
  64. };
  65.  
  66. // video request structure
  67. struct VideoRequestRec    {
  68.     GDHandle        screenDevice;        // <in/out>    nil will force search of best device, otherwise search this device only
  69.     short            reqBitDepth;        // <in>        requested bit depth
  70.     short            availBitDepth;        // <out>    available bit depth
  71.     unsigned long    reqHorizontal;        // <in>        requested horizontal resolution
  72.     unsigned long    reqVertical;        // <in>        requested vertical resolution
  73.     unsigned long    availHorizontal;    // <out>    available horizontal resolution
  74.     unsigned long    availVertical;        // <out>    available vertical resolution
  75.     unsigned long    requestFlags;        // <in>        request flags
  76.     unsigned long    availFlags;            // <out>    available mode flags
  77.     unsigned long    displayMode;        // <out>    mode used to set the screen resolution
  78.     unsigned long    depthMode;            // <out>    mode used to set the depth
  79.     VDSwitchInfoRec    switchInfo;            // <out>    DM2.0 uses this rather than displayMode/depthMode combo
  80. };
  81. typedef struct VideoRequestRec VideoRequestRec;
  82. typedef struct VideoRequestRec *VideoRequestRecPtr;
  83.  
  84. // Routine defines
  85. OSErr RVRequestVideoSetting(VideoRequestRecPtr requestRecPtr);
  86. OSErr RVGetCurrentVideoSetting(VideoRequestRecPtr requestRecPtr);
  87. OSErr RVSetVideoRequest (VideoRequestRecPtr requestRecPtr);
  88. OSErr RVConfirmVideoRequest (VideoRequestRecPtr requestRecPtr);
  89. OSErr RVSetVideoAsScreenPrefs (void);
  90.  
  91.